home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue58 / DragDrop / RichOle.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2000-04-26  |  3.4 KB  |  76 lines

  1. unit RichOle;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, RichEdit, ActiveX, OleCtnrs, ComObj, Menus;
  7.  
  8. type
  9.   IRichEditOleCallback = interface(IUnknown)
  10.     ['{00020D03-0000-0000-C000-000000000046}']
  11.     function GetNewStorage: IStorage; safecall;
  12.     procedure GetInPlaceContext(out Frame: IOleInPlaceFrame;
  13.       out Doc: IOleInPlaceUIWindow; var FrameInfo: TOleInPlaceFrameInfo); safecall;
  14.     procedure ShowContainerUI(fShow: Bool); safecall;
  15.     procedure QueryInsertObject(const ClsID: TCLSID; Stg: IStorage; CP: Longint); safecall;
  16.     procedure DeleteObject(OleObj: IOleObject); safecall;
  17.     procedure QueryAcceptData(dataobj: IDataObject; var cfFormat: TClipFormat;
  18.       reCO: DWord; fReally: Bool; hMetaPict: HGlobal); safecall;
  19.     function ContextSensitiveHelp(fEnterMode: Bool): HResult; stdcall;
  20.     function GetClipboardData(const ChRg: TCharRange; reCO: DWord; out DataObj: IDataObject): HResult; stdcall;
  21.     procedure GetDragDropEffect(fDrag: Bool; grfKeyState: DWord;
  22.       var dwEffect: DWord); safecall;
  23.     procedure GetContextMenu(SelType: Word; OleObj: IOleObject;
  24.       const ChRg: TCharRange; var Menu: HMenu); safecall;
  25.   end;
  26.  
  27.   // Structure passed to GetObject and InsertObject
  28.   TREObject = record
  29.     cbStruct: DWord;          // size of structure in bytes
  30.     cp: Longint;              // character position of object
  31.     ClsID: TClsID;            // class identifier of object
  32.     pOleObj: IOleObject;      // OLE object interface
  33.     pStg: IStorage;           // associated storage interface
  34.     pOleSite: IOleClientSite; // associated client site interface
  35.     sizel: TSize;             // size of object (may be 0,0)
  36.     dvaspect,                 // display aspect to use
  37.     dwFlags,                  // object status flags
  38.     dwUser: DWord;            // user-defined value
  39.   end;
  40.  
  41.   IRichEditOle = interface
  42.     ['{00020D00-0000-0000-C000-000000000046}']
  43.     procedure GetClientSite(out lplpOleSite: IOleClientSite); stdcall;
  44.     function GetObjectCount: Longint; stdcall;
  45.     function GetLinkCount: Longint; stdcall;
  46.     function GetObject(iObj: Longint; out reobject: TREObject;
  47.       dwFlags: DWord): HResult; stdcall;
  48.     function InsertObject(const reobject: TREObject): HResult; stdcall;
  49.     function ConvertObject(iObj: Longint; const clsidNew: TClsId;
  50.       lpStrUserTypeNew: lpCStr): HResult; stdcall;
  51.     function ActivateAs(const clsId, clsIdAs: TClsId): HResult; stdcall;
  52.     function SetHostNames(lpstrContainerApp, 
  53.       lpstrContainerObj: lpCStr): HResult; stdcall;
  54.     function SetLinkAvailable(iObj: Longint; fAvailable: Bool): HResult; stdcall;
  55.     function SetDvaspect(iObj: Longint; dvaspect: DWord): HResult; stdcall;
  56.     function HandsOffStorage(iObj: Longint): HResult; stdcall;
  57.     function SaveCompleted(iObj: Longint; stg: IStorage): HResult; stdcall;
  58.     function InPlaceDeactivate: HResult; stdcall;
  59.     function ContextSensitiveHelp(fEnterMode: Bool): HResult; stdcall;
  60.     function GetClipboardData(const chrg: TCharRange; reco: DWord;
  61.       out dataobj: IDataObject): HResult; stdcall;
  62.     function ImportDataObject(dataobj: IDataObject; cf: TClipFormat;
  63.       hMetaPict: HGlobal): HResult; stdcall;
  64.   end;
  65.  
  66. const
  67.   RECO_PASTE = 0; // paste from clipboard
  68.   RECO_DROP     = 1; // drop
  69.   RECO_COPY     = 2; // copy to the clipboard
  70.   RECO_CUT     = 3; // cut to the clipboard
  71.   RECO_DRAG     = 4; // drag
  72.  
  73. implementation
  74.  
  75. end.
  76.